<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class InitUserStat extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('stats_user', function (Blueprint $table) {
            $table->comment = '单用户统计表';
            
            $table->increments('id');
            $table->uuid('uuid')->index() ;

            $table->integer('user_id')->unsigned()->index()->comment('用户id');

            $table->integer('fudai_pay_money_price')->unsigned()->default(0)->index()->comment('福袋的支付人民币金额');
            $table->integer('fudai_pay_score_price')->unsigned()->default(0)->index()->comment('福袋的支付积分金额');

            $table->integer('fudai_get_money_price')->unsigned()->default(0)->index()->comment('福袋获得的人民币价值');
            $table->integer('fudai_get_score_price')->unsigned()->default(0)->index()->comment('福袋获得的积分价值');

            $table->integer('fudai_sku_total')->unsigned()->default(0)->index()->comment('福袋开盒次数');

            $table->softDeletes();
            $table->timestamps();

        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::disableForeignKeyConstraints();
        Schema::dropIfExists('stats_user');
    }
}
